<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>添加/更新</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/admin/css/animate.min.css" rel="stylesheet">
    <link href="/admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="/admin/frame/layer/css/layui.css" rel="stylesheet">
    <link href="/admin/frame/imgUpload/imgUpload.css" rel="stylesheet">
    <link href="/admin/frame/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
</head>
<body>
<div class="container-fluid" style="margin-top: 30px;">
    <div class="row">
        <div class="col-sm-12 col-md-12">
            <form class="form-horizontal" id="addForm" action="/Admin/Ware/WareGoodsInfo/addOrUpdate">
                <c:if test="${isUpdate==true}">
                    <div class="form-group hidden">
                        <label class="col-sm-2 control-label"><span style="color: red">*</span>编号：</label>
                        <div class="col-sm-6">
                            <input name="id"  value="${obj.id}" class="form-control">
                        </div>
                    </div>
                </c:if>

                <div class="form-group ">
                            <label class="col-sm-2 control-label"><span style="color: red">*</span>商品名称：</label>
                    <div class="col-sm-10">
                                    <input  name="goodsName" minlength="0" maxlength="64" type="text"  value="${obj.goodsName}" class="form-control" placeholder="请输入商品名称">
                            </div>
                        </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red">*</span>首拼查询：</label>
                    <div class="col-sm-10">
                        <input name="goodsPinyin" minlength="0" maxlength="32" type="text" value="${obj.goodsPinyin}"
                               class="form-control" placeholder="请输入首拼查询">
                    </div>
                </div>

                <div class="form-group col-md-6">
                    <label class="col-sm-4 control-label"><span style="color: red">*</span>原价格：</label>
                    <div class="col-sm-8">
                                    <input  name="oldPrice" min="0" type="number"  value="<fmt:formatNumber type="number" value="${obj.oldPrice}" pattern="0.00" maxFractionDigits="2"/>" class="form-control" placeholder="请输入原价格">
                            </div>

                        </div>


                <div class="form-group col-md-6">
                    <label class="col-sm-4 control-label"><span style="color: red">*</span>新价格：</label>
                    <div class="col-sm-8">
                                    <input  name="nowPrice" min="0" type="number"  value="<fmt:formatNumber type="number" value="${obj.nowPrice}" pattern="0.00" maxFractionDigits="2"/>" class="form-control" placeholder="请输入新价格">
                            </div>
                        </div>


                <div class="form-group col-md-6">
                    <label class="col-sm-4 control-label"><span style="color: red">*</span>库存：</label>
                    <div class="col-sm-8">
                                    <input  name="stock" min="0" type="number"  value="${obj.stock}" class="form-control" placeholder="请输入库存">
                            </div>
                        </div>


                <div class="form-group col-md-6">
                    <label class="col-sm-4 control-label"><span style="color: red">*</span>销量：</label>
                    <div class="col-sm-8">
                                    <input  name="sales" min="0" type="number"  value="${obj.sales}" class="form-control" placeholder="请输入销量">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><span style="color: red">*</span>简介描述：</label>
                            <div class="col-sm-10">
                                <textarea rows="5" name="goodsDescribe" minlength="0" maxlength="64" type="text"
                                          class="form-control" placeholder="请输入简介描述">${obj.goodsDescribe}</textarea>
                            </div>
                        </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red">*</span>商品属性：</label>
                    <div class="col-sm-10">
                        <textarea rows="5" name="goodsAttr" minlength="0" maxlength="64" type="text"
                                  class="form-control" placeholder="key:value对应，多个属性中间使用;号分割">${goodsAtt}</textarea>
                    </div>
                </div>

                <div class="form-group col-sm-6">
                    <label class="col-sm-4 control-label"><span style="color: red">*</span>禁用：</label>
                    <div class="col-sm-8">
                        <div class="checkbox">
                            <label>
                                <c:if test="${obj.disabled==1}">
                                    <input type="checkbox" checked class="checkbox" name="disabled" value="1">是否禁用
                                </c:if>
                                <c:if test="${obj.disabled==0 || obj.disabled==null}">
                                    <input type="checkbox" class="checkbox" name="disabled" value="1">是否禁用
                                </c:if>
                            </label>
                        </div>
                    </div>
                </div>


                <div class="form-group col-sm-6">
                    <label class="col-sm-4 control-label"><span style="color: red">*</span>推荐商品：</label>
                    <div class="col-sm-8">
                        <div class="checkbox">
                            <label>
                                <c:if test="${obj.isNominate==1}">
                                    <input type="checkbox" checked class="checkbox" name="disabled" value="1">是否推荐
                                </c:if>
                                <c:if test="${obj.isNominate==0 || obj.isNominate==null}">
                                    <input type="checkbox" class="checkbox" name="disabled" value="1">是否推荐
                                </c:if>
                            </label>
                        </div>

                    </div>
                </div>
                <div class="form-group col-sm-6">
                    <label class="col-sm-4 control-label"><span style="color: red">*</span>可预约：</label>
                    <div class="col-sm-8">
                        <select class="form-control" name="isAppointment">
                            <c:if test="${obj.isAppointment==1}">
                                <option checked value="1">预约商品</option>
                                <option value="0">非预约商品</option>
                            </c:if>
                            <c:if test="${obj.isAppointment!=1}">
                                <option value="1">预约商品</option>
                                <option checked value="1">非预约商品</option>
                            </c:if>
                        </select>
                    </div>
                </div>

                <div class="form-group col-sm-6">
                    <label class="col-sm-4 control-label"><span style="color: red">*</span>品牌：</label>
                    <div class="col-sm-8">
                        <select class="form-control" name="goodsBrandId">
                            <c:forEach items="${brandList}" var="item">
                                <c:if test="${item.id==obj.goodsBrandId}">
                                    <option checked value="${item.id}">${item.brandName}</option>
                                </c:if>
                                <c:if test="${item.id!=obj.goodsBrandId}">
                                    <option value="${item.id}">${item.brandName}</option>
                                </c:if>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red">*</span>三级类型：</label>
                    <div class="col-sm-6">
                        <select class="form-control" name="goodsTypeId">
                            <c:forEach items="${gradeList}" var="item">
                                <c:if test="${item.id==grade}">
                                    <option checked value="${item.id}">${item.typeName}</option>
                                </c:if>
                                <c:if test="${item.id!=grade}">
                                    <option value="${item.id}">${item.typeName}</option>
                                </c:if>
                            </c:forEach>
                        </select>
                    </div>


                </div>


                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red">*</span>预览图：</label>
                    <div class="col-sm-6">
                        <div class="imgupload-wrap" img-count="1" img-name="previewImgAddress">
                            <input type="text" value="${obj.previewImgAddress}" class="form-control"
                                   placeholder="请输入预览图">
                        </div>

                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red">*</span>商品图片：</label>
                    <div class="col-sm-10">
                        <div class="imgupload-wrap" img-count="6" img-name="goodsImg">
                            <c:forEach items="${goodsImgList}" var="item">
                                <input value="${item.imgAddress}">
                            </c:forEach>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red">*</span>商品详情：</label>
                    <div class="col-sm-10">
                        <textarea id="myEditor" name="goodsDetail" style="height: 400px;"
                                  class="form-control">${goodsDetail.content}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-10">
                        <button class="btn btn-primary">立即保存</button>
                        <button class="btn btn-default">取消</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

</body>
<script src="/admin/frame/jquery/jquery-1.9.1.min.js"></script>
<script src="/admin/frame/bootstrap/js/bootstrap.min.js"></script>
<script src="/admin/js/content.min.js?v=1.0.0"></script>
<script src="/admin/frame/jquery-validate/jquery.validate.min.js"></script>
<script src="/admin/frame/jquery-validate/messages_zh.min.js"></script>
<script src="/admin/frame/imgUpload/imgUpload.js"></script>
<script type="text/javascript" src="/admin/frame/umeditor/third-party/template.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/admin/frame/umeditor/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/admin/frame/umeditor/umeditor.min.js"></script>
<script>
    $().ready(function() {
        $("#addForm").validate();
        var grade1 = $("#grade1").val();

    });
    var um = UM.getEditor('myEditor');
</script>
</html>
